(C) 1996 AROS - The Amiga Replacement OS


NAME
LONG SPFloor()
SYNOPSIS
LONG y

LOCATION
In MathBase at offset 15
FUNCTION
Calculate the largest integer ffp-number less than or equal to fnum

INPUTS
y
ffp number
RESULT
ffp number

Flags: zero : result is zero negative : result is negative overflow : 0 (???)

NOTES
EXAMPLE
       floor(10.5) = 10
       floor(0.5)  = 0
       floor(-0.5) = -1
       floor(-10.5)= -11

BUGS
SEE ALSO
INTERNALS
ALGORITHM: The integer part of a ffp number are the left "exponent"-bits of the mantisse! Therefore: Test the exponent for <= 0. This has to be done separately! If the sign is negative then return -1 otherwise return 0.

Generate a mask of exponent(y) (where y is the given ffp-number) bits starting with bit 31. If y < 0 then test whether it is already an integer. If not then y = y - 1 and generate that mask again. Use the mask on the mantisse.

HISTORY
25.06.1997 bergers
*** empty log message ***
30.05.1997 aros
*** empty log message ***